home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / ZIP19.ARJ / OS2ZIP.H < prev    next >
C/C++ Source or Header  |  1992-08-12  |  2KB  |  83 lines

  1. /*
  2.  * @(#) dir.h 1.4 87/11/06   Public Domain.
  3.  *
  4.  *  A public domain implementation of BSD directory routines for
  5.  *  MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
  6.  *  August 1987
  7.  *
  8.  *  Enhanced and ported to OS/2 by Kai Uwe Rommel; added scandir() prototype
  9.  *  December 1989, February 1990
  10.  *  Change of MAXPATHLEN for HPFS, October 1990
  11.  */
  12.  
  13.  
  14. #define MAXNAMLEN  256
  15. #define MAXPATHLEN 256
  16.  
  17. #define A_RONLY    0x01
  18. #define A_HIDDEN   0x02
  19. #define A_SYSTEM   0x04
  20. #define A_LABEL    0x08
  21. #define A_DIR      0x10
  22. #define A_ARCHIVE  0x20
  23.  
  24.  
  25. struct direct
  26. {
  27.   ino_t    d_ino;                   /* a bit of a farce */
  28.   int      d_reclen;                /* more farce */
  29.   int      d_namlen;                /* length of d_name */
  30.   char     d_name[MAXNAMLEN + 1];   /* null terminated */
  31.   /* nonstandard fields */
  32.   long     d_size;                  /* size in bytes */
  33.   unsigned d_mode;                  /* DOS or OS/2 file attributes */
  34.   unsigned d_time;
  35.   unsigned d_date;
  36. };
  37.  
  38. /* The fields d_size and d_mode are extensions by me (Kai Uwe Rommel).
  39.  * The find_first and find_next calls deliver this data without any extra cost.
  40.  * If this data is needed, these fields save a lot of extra calls to stat()
  41.  * (each stat() again performs a find_first call !).
  42.  */
  43.  
  44. struct _dircontents
  45. {
  46.   char *_d_entry;
  47.   long _d_size;
  48.   unsigned _d_mode, _d_time, _d_date;
  49.   struct _dircontents *_d_next;
  50. };
  51.  
  52. typedef struct _dirdesc
  53. {
  54.   int  dd_id;                   /* uniquely identify each open directory */
  55.   long dd_loc;                  /* where we are in directory entry is this */
  56.   struct _dircontents *dd_contents;   /* pointer to contents of dir */
  57.   struct _dircontents *dd_cp;         /* pointer to current position */
  58. }
  59. DIR;
  60.  
  61.  
  62. extern DIR *opendir(char *);
  63. extern struct direct *readdir(DIR *);
  64. extern void seekdir(DIR *, long);
  65. extern long telldir(DIR *);
  66. extern void closedir(DIR *);
  67. #define rewinddir(dirp) seekdir(dirp, 0L)
  68.  
  69. int GetFileMode(char *name);
  70. long GetFileTime(char *name);
  71. void SetFileTime(char *path, long stamp);
  72.  
  73. int IsFileNameValid(char *name);
  74. int IsFileSystemFAT(char *dir);
  75. void ChangeNameForFAT(char *name);
  76.  
  77. char *GetLongNameEA(char *name);
  78. char *GetLongPathEA(char *name);
  79. void GetEAs(char *name, char **bufptr, unsigned *size,
  80.                         char **cbufptr, unsigned *csize);
  81.  
  82. char *StringLower(char *);
  83.